package com.ruoyi.edge.rule.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.mybatis.core.page.PageQuery;
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
import com.ruoyi.edge.rule.domain.RuleConfigChart;
import com.ruoyi.edge.rule.service.RuleConfigChartService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 图形计算规则配置
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/ruleConfigChart")
public class RuleConfigChartController extends BaseController {

    private final RuleConfigChartService ruleConfigChartService;

    /**
     * 获取列表
     */
    @SaCheckPermission("edge:ruleConfigChart:listPage")
    @GetMapping("/listPage")
    public TableDataInfo<RuleConfigChart> listPage(RuleConfigChart ruleConfigChart, PageQuery pageQuery) {
        return ruleConfigChartService.listPage(ruleConfigChart, pageQuery);
    }

    /**
     * 获取详情
     */
    @SaCheckPermission("edge:ruleConfigChart:get")
    @GetMapping("/get")
    public R<RuleConfigChart> get(String id) {
        return ruleConfigChartService.get(id);
    }

    /**
     * 新增
     */
    @SaCheckPermission("edge:ruleConfigChart:add")
    @PostMapping("add")
    public R<String> add(@RequestBody RuleConfigChart ruleConfigChart) {
        return ruleConfigChartService.add(ruleConfigChart);
    }

    /**
     * 编辑
     */
    @SaCheckPermission("edge:ruleConfigChart:edit")
    @PutMapping("edit")
    public R<String> edit(@RequestBody RuleConfigChart ruleConfigChart) {
        return ruleConfigChartService.edit(ruleConfigChart);
    }

    /**
     * 删除
     */
    @SaCheckPermission("edge:ruleConfigChart:remove")
    @DeleteMapping("remove")
    public R<String> remove(String id) {
        return ruleConfigChartService.remove(id);
    }
}
